<template>
    <div>
      <el-dialog title="批量添加" :visible.sync="open">
        <el-form :model="form" :label-width="80">
          <el-form-item label="活动名称" >
          <file-upload ref="fileUpload"
                       :limit="1"
                       :fileSize="5"
                       :fileType="['xls','xlsx']"
                       @input="handleInput"
          ></file-upload>
          </el-form-item>

        </el-form>
<!--        <div slot="footer" class="dialog-footer">-->
          <el-button @click="open = false">取 消</el-button>
          <el-button type="primary" @click="submitForm">确 定</el-button>
<!--        </div>-->
      </el-dialog>

    </div>
</template>

<script>
  import FileUpload from '@/components/FileUpload';
  import { uploadClues } from "@/api/crm/clue";
  export default {
        name: "batch-add",
      components:{ FileUpload },
      data(){
          return {
            open:false,
            form:{
              filename:'',
            },
          }
      },
      created() {

      },
      methods:{
          //批量添加获取图片
        handleInput(filenames){
          console.log(filenames)
           this.form.filename=filenames;
        },
        resetForm(){
           this.form={
             filename:'',
           }
        },
        //批量添加
        submitForm(){
          uploadClues(this.form).then(resp=>{
            // this.$refs.fileUpload.clearFiles();
             this.$modal.msgSuccess('操作成功');
             this.open=false;
             this.$emit('success')
          })

        }
      }
    }
</script>

<style scoped>

</style>
